<template>
  <div class="root">


    <div class="row">
      <div class="cell" style="margin-right: 40px">
        <el-upload class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/" :on-success="handleSuccess"
          :file-list="fileList" list-type="picture">
          <div class="upload" @click="updataFile">上传文件</div>
          <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div> -->
        </el-upload>


      </div>
    </div>

    <div class="row">
      <div class="cell" style="margin-right: 40px">
        <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="textarea">
        </el-input>
      </div>
    </div>
    <div class="row" style="margin: 15px 0">
      <button class="button" style="margin-right: 25px" @click="updata">
        更新
      </button>
    </div>
  </div>
</template>

<script>
import request from "@/utils/request";
export default {
  data() {
    return {
      fileList: [],
      textarea: ''
    };
  },
  methods: {
    loadData() { },
    handleSuccess(res, file) {

    },
    updataFile() {

    },
    async updata() {
      console.log('updata---------');
      let { data } = await request({
        url: '/message/save',
        method: "post",
        params: {
          "type": "home",
          "title": "标题",
          "description": "描述。副标题",
          "contain": this.textarea
        }
      })
    },
  },
};
</script>

<style scoped lang="scss">
.root {
  height: 100%;
  width: 100%;
  display: flex;
  padding: 0 20px;
  flex-direction: column;
}

.row {
  display: flex;
  flex-direction: row;
}

.cell {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  margin-top: 15px;


  .upload {
    width: 130px;
    height: 37px;
    line-height: 37px;
    color: white;
    margin-right: 15px;
    background: #3894ff;
  }
}

::v-deep .el-textarea__inner {
  height: 500px !important;
  width: 500px !important;
}


.button {
  height: 30px;
  line-height: 30px;
  padding: 0 30px;
  color: #1996fa;
  background: #e6f1fc;
  border: 1px solid #d0e7fe;
  border-radius: 5px;
}
</style>
